<?
//status: regmail:0 ; off: 1; onchat:2; oncpanel: 3 ; lock:4
//send msg offline to all guest:
	$h=">>>>>";
	$msg="Offline >>>>>";
	$dbsql->query("update ".$GLOBALS['first_table']."tblchat set cText=concat(cText,'".$h.$username."++".$msg."$$') where iUserId='$userid'");
	
	//logout chat admin:
	set_Cookie(_NAMECOOKIELOGINUSER,"logouted");
	$timeout=_TIME+5;
	$rs=$dbsql->query("update ".$GLOBALS['first_table']."tbluser set iStatus=1, iTimeOut=0,cSId='' where iUserId='$userid'");	
	if($rs)
	{
		//echo "Logouted";exit();
	}	
	header("location: chat.php?opt=login");
	exit();

?>